﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace BanSach
{
    public partial class frmNXB : Form
    {
        public frmNXB()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = NXB_BUS.LoadNXB();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string manxb = textBox3.Text;
            string tennxb = textBox4.Text;
            string diachi = textBox5.Text;
            string sdt = textBox6.Text;
            string fax = textBox7.Text;
            string matk = textBox8.Text;
            
            NXB_DTO nxb = new NXB_DTO(manxb, tennxb, diachi, sdt,fax, matk);
            NXB_BUS.ThemNXB(nxb);
            dataGridView1.DataSource = NXB_BUS.LoadNXB();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string manxb = textBox3.Text;
            string tennxb = textBox4.Text;
            string diachi = textBox5.Text;
            string sdt = textBox6.Text;
            string fax = textBox7.Text;
            string matk = textBox8.Text;

            NXB_DTO nxb = new NXB_DTO(manxb, tennxb, diachi, sdt, fax, matk);
            NXB_BUS.SuaNXB(nxb);
            dataGridView1.DataSource = NXB_BUS.LoadNXB();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            NXB_BUS.XoaNXB(textBox2.Text);
            dataGridView1.DataSource = NXB_BUS.LoadNXB();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = NXB_BUS.TimNXB(textBox1.Text);
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox3_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox4_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
    }
}
